package gui.edit.listeners;

import gui.edit.components.TwoActorsRelationPanel;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.JRadioButton;

/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class ListenerActorsRelation extends ListenerParamChange implements ActionListener{

	public ListenerActorsRelation(JPanel parent){
		super(parent);
	}
	
		public void actionPerformed(ActionEvent e) {
			JRadioButton selected = (JRadioButton)e.getSource();
			if(selected==((TwoActorsRelationPanel)parent).getBoxActor1Dominates()){
				((TwoActorsRelationPanel)parent).getLabelActor1().setFont(TwoActorsRelationPanel.bigSize);
				((TwoActorsRelationPanel)parent).getLabelActor1().setForeground(Color.RED);
				((TwoActorsRelationPanel)parent).getLabelActor2().setFont(TwoActorsRelationPanel.smallSize);
				((TwoActorsRelationPanel)parent).getLabelActor2().setForeground(Color.BLUE);
			}
			else if(selected==((TwoActorsRelationPanel)parent).getBoxActor2Dominates()){
				((TwoActorsRelationPanel)parent).getLabelActor1().setFont(TwoActorsRelationPanel.smallSize);
				((TwoActorsRelationPanel)parent).getLabelActor1().setForeground(Color.BLUE);
				((TwoActorsRelationPanel)parent).getLabelActor2().setFont(TwoActorsRelationPanel.bigSize);
				((TwoActorsRelationPanel)parent).getLabelActor2().setForeground(Color.RED);
			}
			else if(selected==((TwoActorsRelationPanel)parent).getBoxAffinity()){
				((TwoActorsRelationPanel)parent).getLabelActor1().setFont(TwoActorsRelationPanel.normalSize);
				((TwoActorsRelationPanel)parent).getLabelActor1().setForeground(Color.BLACK);
				((TwoActorsRelationPanel)parent).getLabelActor2().setFont(TwoActorsRelationPanel.normalSize);
				((TwoActorsRelationPanel)parent).getLabelActor2().setForeground(Color.BLACK);
			}
			else{
				System.err.println("TwoActorsRelationPanel: Relation inexistante");
			}

		}
}
